package cn.kgc.service.impl;

import cn.kgc.dao.PersonnelDao_jjb;
import cn.kgc.dao.SalaryStandarDao;
import cn.kgc.pojo.PersonnelJ;
import cn.kgc.pojo.SalaryPO;
import cn.kgc.service.PersonnelService_jjb;
import cn.kgc.service.SalaryStandardService;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

@Service
public class SalaryStandardServiceImpl implements SalaryStandardService {

    @Resource
    private SalaryStandarDao salaryStandarDao;

    /**
     * @param salaryId
     * @param inputtingTime1
     * @param inputtingTime2
     * @return
     */

    @Override
    public List<SalaryPO> findAll(String salaryId, String fileStatus, String inputtingTime1, String inputtingTime2) {
        List<SalaryPO> salaryPOS = salaryStandarDao.findAll(salaryId, fileStatus, inputtingTime1, inputtingTime2);
        if (!Objects.isNull(salaryPOS)) {
            return salaryPOS;
        }
        return null;
    }

    @Override
    public boolean addSalaryStandard(SalaryPO salaryPO) {
        int i = salaryStandarDao.addSalaryStandard(salaryPO);
        if (i > 0) {
            return true;
        }
        return false;
    }

    @Override
    public SalaryPO findOne(String salaryId) {
        return salaryStandarDao.findOne(salaryId);
    }

    /**
     * 删除
     *
     * @param salaryId
     * @return
     */
    @Override
    public boolean delSalary(String salaryId) {
        return salaryStandarDao.delSalary(salaryId) > 0;
    }

    @Override
    public boolean updateSalary(SalaryPO salaryPO) {
        return salaryStandarDao.updateSalary(salaryPO) > 0;
    }

    @Override
    public boolean review(String salaryId) {
        return salaryStandarDao.review(salaryId) > 0;
    }

    @Override
    public boolean checkDate(String salaryId, String reviewComments) {

        return salaryStandarDao.checkDate(salaryId,reviewComments)>0;
    }
}
